user = [{'account':'a1234','password':'123456','balance':3000},{'account':'tt1234','password':'1234567','balance':20000}]
print('-'*12+'自动取款机操作系统'+'-'*12)
print('{0:>15}  {1:<15}'.format('1.查询余额','2.取款'))
print('{0:>15}  {1:<15}'.format('3.存钱','2.退出'))
print('='*60)
account = input('请输入您的账号：')
password = input('请输入您的密码：')
for i,user_dict in enumerate(user):
   if user_dict['account'] == account and user_dict['password'] == password:
    #   print('登录成功')
        login = True
        id = i
        print('登录成功')
#    else:
#        print('登录失败')     
while login:
   operation = input('请输入对应的操作:')
   if operation == '1':
       print(f"您的余额为:{user[id]['balance']}")
       input('按回车键继续:')
   elif operation == '2':
       take = input('请输入您的取款金额:')
       if user[id]['balance']<int(take):
          print('您的余额不足')
          input('按回车键继续:') 
       else:
           user[id]['balance']-=int(take)
           print(f"您现在的余额为{user[id]['balance']}")
           input('按回车键继续:')    
   elif operation == 3:
       exist = input('请输入您的存款金额:')
       if int(exist) <= 0:
           print('存款数必须大于0')
           input('按回车键继续:')
       else:
             user[id]['balance']+=int(take)
             print(f"您现在的余额为{user[id]['balance']}") 
             input('按回车键继续:')     
   elif operation == '4':
       print('='*20+'再见'+'='*20)
       login = False
       break
   else:
       print('操作错误')
       input('按回车键继续:')          
